/*
 * bt.c
 *
 *  Created on: 12.12.2011
 *      Author: Moritz
 */


#include "serial.h"
#include "timing.h"



int bt_init (Usart serial) {

	return 1;
}

int bt_start (Usart usart) {
	usart_puts(usart,"\r\n+INQ=1\r\n");
	return 1;
}



int bt_setup (Usart usart, char *deviceName, char *pin) {
	usart_puts(usart,"\r\n+INQ=0\r\n");
	delayms(2000);
	usart_puts(usart,"\r\n+STWMOD=0\r\n");
	delayms(2000);
	usart_puts(usart,"\r\n+STNA=");
	usart_puts(usart, deviceName);
	usart_puts(usart,"\r\n");
	delayms(2000);
	usart_puts(usart,"\r\n+STAUTO=1\r\n");
	delayms(2000);
	usart_puts(usart,"\r\n+STOAUT=1\r\n");
	delayms(2000);
	usart_puts(usart,"\r\n+STPIN=");
	usart_puts(usart, pin);
	usart_puts(usart,"\r\n");
	delayms(2000);
	return 1;
}

